#--------------------------------------------
# title：HYSD磁盘监测系统v7.3
# author：weiyc
# site：http://www.hysdqx.com/
#--------------------------------------------

#!/bin/sh

set -e

#menu
#set the date,user and hostname up
MYDATE=`date +%d/%m/%Y`
THIS_HOST=`hostname -s`
USER=`whoami`
PWD=`pwd`

trap "" 2 3 15  #忽视信号：
				#HUP(1)　　 挂起，通常因终端掉线或用户退出而引发
				#INT(2)　　 中断，通常因按下Ctrl+C组合键而引发
				#QUIT(3)　　退出，通常因按下Ctrl+组合键而引发
				#ABRT(6)　　中止，通常因某些严重的执行错误而引发
				#ALRM(14)　 报警，通常用来处理超时
				#TERM(15)　 终止，通常在系统关机时发送

#### colour function
colour ()
{
	case $1 in
		black_green)
			echo -e '\033[40;32m';;
		black_yellow)
			echo -e '\033[40;33m';;
		black_white)
			echo -e '\033[40;37m';;
		black_cyan)
			echo -e '\033[40;36m';;
		red_yellow)
			echo -e '\033[41;33m';;
	esac
}

#### single key function
get_char()
{
	#get_char
    #save current stty setting
	SAVEDSTTY=`stty -g`
	#如果你的机器上不认stty raw那么把函数中两处出现的raw换成cbreak
	stty cbreak
	dd if=/dev/tty bs=1 count=1 2>/dev/null
	stty -cbreak
	#restore stty
	stty $SAVEDSTTY
}

#### built_in_disk_size function
built_in_disk_size()
{
	mmcblk0_size=15.8 #注意等号左右空格
	#echo $mmcblk0_size
    mmcblk0p1_size=$(df -l / | awk  '/\/$/{print int($3)}') #注意等号左右空格
	#echo $mmcblk0p1_size
	echo -e "\n"
	df -hl
	#echo -e "\n"
	#12582912=13.5G
	if [ $mmcblk0p1_size -ge 12582912 ]; #注意判断语句空格
		then  
			colour red_yellow
			avail_mmcblk0p1_size=$(df -h / | awk  '/\/$/{print ($4)}')
			echo  "警告！内置EMMC还剩'$avail_mmcblk0p1_size'，存储不够，需要更换！"
	#14155776=12G
  	elif [ $mmcblk0p1_size -ge 14155776 -a $mmcblk0p1_size -gt 12582912 ]; #不要用&&
		then 
			colour black_yellow
			avail_mmcblk0p1_size=$(df -h / | awk  '/\/$/{print ($4)}')
			echo  "预防！内置EMMC还剩'$avail_mmcblk0p1_size'，小心使用！"
  	else
		colour black_green
		avail_mmcblk0p1_size=$(df -h / | awk  '/\/$/{print ($4)}')
  	  	echo  "正常！内置EMMC还剩'$avail_mmcblk0p1_size'，放心使用！"
  	fi
	#df -h  /  |  awk  '/\/$/{print  "根分区的剩余容量是"$4M}'
}
 
#### big_disk_size function
big_disk_size()
{
	mmcblk1_size=115 #注意等号左右空格
	#echo $mmcblk1_size
    avail_mmcblk1_size=$(df -l /dev/mmcblk1 | awk  'NR==2 {print $4}') #注意等号左右空格
	#echo $avail_mmcblk1_size
	echo -e "\n"
	df -hl
	#echo -e "\n"
	#1048576=1G
	if [ $avail_mmcblk1_size -le 1048576 ]; #注意判断语句空格
		then  
			colour red_yellow
			avail_mmcblk0p1_size_dfh=$(df -h /dev/mmcblk1 | awk  'NR==2 {print ($4)}')
			echo  "警告！外置EMMC还剩'$avail_mmcblk0p1_size_dfh'，存储不够，需要更换！"
	#3145728=3G
  	elif [ $avail_mmcblk1_size -le 3145728 -a $avail_mmcblk1_size -gt 1048576 ]; #不要用&&
		then 
			colour black_yellow
			avail_mmcblk0p1_size_dfh=$(df -h /dev/mmcblk1 | awk  'NR==2 {print ($4)}')
			echo  "预防！外置EMMC还剩'$avail_mmcblk0p1_size_dfh'，小心使用！"
  	else
		colour black_green
		avail_mmcblk0p1_size_dfh=$(df -h /dev/mmcblk1 | awk  'NR==2 {print ($4)}')
  	  	echo  "正常！外置EMMC还剩'$avail_mmcblk0p1_size_dfh'，放心使用！"
  	fi
	#df -h  /  |  awk  '/\/$/{print  "根分区的剩余容量是"$4M}'
}

#### disk_size function
disk_size()
{
	local i=0
	#注意循环空格
	while(($i==0))
	do
		#clear the screen
		tput clear
		colour black_yellow
		#here documents starts here
		cat <<HYSD
---------------------------------------------------------------------------
 User:$USER  Host:HYSD  Date:$MYDATE  Pwd:$PWD
---------------------------------------------------------------------------
  1 : 内置EMMC磁盘容量检测              2 : 外置EMMC磁盘容量检测
  H : Help screen                       U : 返回上一级
  Q : Exit Menu
---------------------------------------------------------------------------
HYSD
		colour black_white
		echo -e -n "\tYour Choice [1,2,U,H,Q] > "
			read CHOICE
			case $CHOICE in
						1) 	built_in_disk_size ;;
						2) 	big_disk_size ;;
						U|u)	
							echo -e "\t ok!"
							i=1 ;;
						H|h)
							cat <<HYSD
	技术支持：http://www.hysdqx.com/
HYSD
;;
						Q|q)	exit 0 ;;
						*)	echo -e "\t\041Unknown user response";;
			esac
		if [ $i -eq 0 ]; 
			then
				colour black_white
				echo -e -n "\tHit the any key to continue"
				get_char
		fi
	done		
}

#### disk_monitoring_part function
disk_monitoring_part()
{
	res="未修改！"
	echo -e "\t\n耐心等待3min，正在为您检查内置EMMC健康状况... ..."
	
	if [ ! -d /home/nvidia/disk_monitoring_log  ];
		then
			mkdir /home/nvidia/disk_monitoring_log
			sudo chmod 777 /home/nvidia/disk_monitoring_log
	else
			echo "dir exist ok"
	fi
	
	sudo badblocks -v -s /dev/mmcblk0 > /home/nvidia/disk_monitoring_log/HYSD_badsectors.txt
	if [ -s HYSD_badsectors.txt ]; 
		then
			colour red_yellow
			echo -e -n "内置EMMC磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l badsectors.txt /dev/mmcblk0 #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l badsectors.txt /dev/mmcblk0 #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "内置EMMC磁盘健康！无坏道现象！ \n"
	fi
}
 
#### disk_monitoring_entirety function
disk_monitoring_entirety()
{
#-----------------------------------------------------------------------
#/dev/zram1 /dev/zram2 /dev/zram3
#/dev/mmcblk1boot0 /dev/mmcblk1boot1
#/dev/mmcblk1rpmb
#/dev/mmcblk0 -> /dev/mmcblk0boot1 /dev/mmcblk0boot0 /dev/mmcblk0rpmb
#-----------------------------------------------------------------------
	res="未修改！"
	colour black_white
	echo -e "\t\n耐心等待1min，正在为您检查zram1健康状况... ..."
	colour black_white
	
	if [ ! -d /home/nvidia/disk_monitoring_log  ];
		then
			mkdir /home/nvidia/disk_monitoring_log
			sudo chmod 777 /home/nvidia/disk_monitoring_log
		else
			echo "dir exist ok"
	fi
	
	sudo badblocks -v -s /dev/zram1 > /home/nvidia/disk_monitoring_log/HYSD_badsectors_zram1.txt
	if [ -s HYSD_badsectors_zram1.txt ]; 
		then
			colour red_yellow
			echo -e -n "zram1磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l HYSD_badsectors_zram1.txt /dev/zram1 #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l HYSD_badsectors_zram1.txt /dev/zram1 #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "zram1磁盘健康！无坏道现象！ \n"
	fi
	
	colour black_white
	echo -e "\t\n耐心等待1min，正在为您检查zram2健康状况... ..."
	sudo badblocks -v -s /dev/zram2 > /home/nvidia/disk_monitoring_log/HYSD_badsectors_zram2.txt
	if [ -s HYSD_badsectors_zram2.txt ]; 
		then
			colour red_yellow
			echo -e -n "zram2磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l HYSD_badsectors_zram2.txt /dev/zram2 #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l HYSD_badsectors_zram2.txt /dev/zram2 #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "zram2磁盘健康！无坏道现象！ \n"
	fi
	
	colour black_white
	echo -e "\t\n耐心等待1min，正在为您检查mmcblk1boot0健康状况... ..."
	sudo badblocks -v -s /dev/mmcblk1boot0 > /home/nvidia/disk_monitoring_log/HYSD_badsectors_mmcblk1boot0.txt
	if [ -s HYSD_badsectors_mmcblk1boot0.txt ]; 
		then
			colour red_yellow
			echo -e -n "mmcblk1boot0磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l HYSD_badsectors_mmcblk1boot0.txt /dev/mmcblk1boot0 #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l HYSD_badsectors_mmcblk1boot0.txt /dev/mmcblk1boot0 #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "mmcblk1boot0磁盘健康！无坏道现象！ \n"
	fi
	
	colour black_white
	echo -e "\t\n耐心等待1min，正在为您检查mmcblk1boot1健康状况... ..."
	sudo badblocks -v -s /dev/mmcblk1boot1 > /home/nvidia/disk_monitoring_log/HYSD_badsectors_mmcblk1boot1.txt
	if [ -s HYSD_badsectors_mmcblk1boot1.txt ]; 
		then
			colour red_yellow
			echo -e -n "mmcblk1boot1磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l HYSD_badsectors_mmcblk1boot1.txt /dev/mmcblk1boot1 #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l HYSD_badsectors_mmcblk1boot1.txt /dev/mmcblk1boot1 #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "mmcblk1boot1磁盘健康！无坏道现象！ \n"
	fi
	
	colour black_white
	echo -e "\t\n耐心等待1min，正在为您检查外置mmcblk1rpmb健康状况... ..."
	sudo badblocks -v -s /dev/mmcblk1rpmb > /home/nvidia/disk_monitoring_log/HYSD_badsectors_mmcblk1rpmb.txt
	if [ -s HYSD_badsectors_mmcblk1rpmb.txt ]; 
		then
			colour red_yellow
			echo -e -n "外置mmcblk1rpmb磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l HYSD_badsectors_mmcblk1rpmb.txt /dev/mmcblk1rpmb #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l HYSD_badsectors_mmcblk1rpmb.txt /dev/mmcblk1rpmb #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "外置mmcblk1rpmb磁盘健康！无坏道现象！ \n"
	fi
	
	colour black_white
	echo -e "\t\n耐心等待1min，正在为您检查zram3健康状况... ..."
	sudo badblocks -v -s /dev/zram3 > /home/nvidia/disk_monitoring_log/HYSD_badsectors_zram3.txt
	if [ -s HYSD_badsectors_zram3.txt ]; 
		then
			colour red_yellow
			echo -e -n "zram3磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l HYSD_badsectors_zram3.txt /dev/zram3 #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l HYSD_badsectors_zram3.txt /dev/zram3 #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "zram3磁盘健康！无坏道现象！ \n"
	fi
	
	colour black_white
	echo -e "\t\n耐心等待3min，正在为您检查内置EMMC健康状况... ..."
	sudo badblocks -v -s /dev/mmcblk0 > /home/nvidia/disk_monitoring_log/HYSD_badsectors.txt
	if [ -s HYSD_badsectors.txt ]; 
		then
			colour red_yellow
			echo -e -n "内置EMMC磁盘出现坏道！是否修复"
			read -p " (Y/N)：" enter
				if [ "$enter" == "Y" ];
					then
						sudo e2fsck -l badsectors.txt /dev/mmcblk0 #针对 for ext2/ext3/ext4 文件系统
						#sudo fsck -l badsectors.txt /dev/mmcblk0 #针对其它文件系统
				else
					echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
					sleep 3s
				fi
	else
		colour black_green
		echo -e "内置EMMC磁盘健康！无坏道现象！ \n"
	fi
}
 
#### disk_monitoring function
disk_monitoring()
{
	local i=0
	#注意循环空格
	while(($i==0))
	do
		#clear the screen
		tput clear
		colour black_yellow
		#here documents starts here
		cat <<HYSD
---------------------------------------------------------------------------
 User:$USER  Host:HYSD  Date:$MYDATE  Pwd:$PWD
---------------------------------------------------------------------------
  1 : 磁盘坏道全区检测          2 : 磁盘坏道分区检测
  H : Help screen               U : 返回上一级
  Q : Exit Menu
  检查系统查询到有磁盘坏道出现时，请先联系供应厂商研发人员！！请勿自修复
---------------------------------------------------------------------------
HYSD
		colour black_white
		echo -e -n "\tYour Choice [1,2,U,H,Q] > "
			read CHOICE
			case $CHOICE in
						1) 	disk_monitoring_entirety ;;
						2) 	disk_monitoring_part ;;
						U|u)	
							echo -e "\t ok!"
							i=1 ;;
						H|h)
							cat <<HYSD
	技术支持：http://www.hysdqx.com/
HYSD
;;
						Q|q)	exit 0 ;;
						*)	echo -e "\t\041Unknown user response";;
			esac
		if [ $i -eq 0 ]; 
			then
				colour black_white
				echo -e -n "\tHit the any key to continue"
				get_char
		fi
	done		
}

#### 是否清理内存的free
clear_memory_free()
{
#------------------------------------------------------------------
#drop_caches的值可以是0-3之间的数字，代表不同的含义：
#0：不释放（系统默认值）
#1：释放页缓存
#2：释放dentries和inodes
#3：释放所有缓存
#------------------------------------------------------------------
	save="以保存数据完成... ... "
	clear="清理完毕！"
	res="本次未清理！3S后退出！"
	read -p " 是否清理(Y/N)：" enter
			if [ "$enter" == "Y" ];
				then
					sync
					echo -e "\033[40;37m ${save} \033[0m \n"  ## 黑底白字
					#sudo chmod 777 /proc/sys/vm/drop_caches
					#sudo -i
					#echo 'nvidia' | sudo -S sh -c "echo 3 > /proc/sys/vm/drop_caches"
					sudo sh -c "echo 3 > /proc/sys/vm/drop_caches"
					#echo 2 > /proc/sys/vm/drop_caches
					#echo 1 > /proc/sys/vm/drop_caches
					#echo 0 > /proc/sys/vm/drop_caches
					echo -e "\033[40;37m ${clear} \033[0m \n"  ## 黑底白字
					#sudo chmod 644 /proc/sys/vm/drop_caches
			else
				echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
				sleep 3s
			fi
}

#### 是否清理内存的available
clear_memory_available()
{
#------------------------------------------------------------------
#drop_caches的值可以是0-3之间的数字，代表不同的含义：
#0：不释放（系统默认值）
#1：释放页缓存
#2：释放dentries和inodes
#3：释放所有缓存
#------------------------------------------------------------------
	save="以保存数据完成... ... "
	clear="清理完毕！"
	res="本次未清理！3S后退出！"
	read -p " 是否清理(Y/N)：" enter
			if [ "$enter" == "Y" ];
				then
					sync
					echo -e "\033[40;37m ${save} \033[0m \n"  ## 黑底白字
					#sudo chmod 777 /proc/sys/vm/drop_caches
					#sudo -i
					#echo 3 > /proc/sys/vm/drop_caches
					#echo 'nvidia' | sudo -S sh -c "echo 2 > /proc/sys/vm/drop_caches"
					sudo sh -c "echo 2 > /proc/sys/vm/drop_caches"
					#echo 1 > /proc/sys/vm/drop_caches
					#echo 0 > /proc/sys/vm/drop_caches
					echo -e "\033[40;37m ${clear} \033[0m \n"  ## 黑底白字
					#sudo chmod 644 /proc/sys/vm/drop_caches
			else
				echo -e "\033[41;33m ${res} \033[0m \n"  ## 红底黄字
				sleep 3s
			fi
}

#### memory function
memory_monitoring()
{
	total=3.9 #注意等号左右空格
	#echo $total
    available_size=$(free | awk  ' NR==2 {print int($7)}') #注意等号左右空格
	#echo $available_size
	free_size=$(free | awk  ' NR==2 {print int($4)}') #注意等号左右空格
	#echo $free_size
	echo -e "\n"
	free -h
	#-------------------------------------
	#还可以被 应用程序 使用的物理内存大小
	#-------------------------------------
	#512000=500M
	if [ $available_size -le 512000 ]; #注意判断语句空格
		then  
			colour red_yellow
			available_size_human=$(free -h | awk  ' NR==2 {print ($7)}')
			echo  "警告！支持应用程序的内存还剩可用'$available_size_human'，内存不够，尽快释放内存！"
			clear_memory_available
	#1048576=1G
  	elif [ $available_size -gt 512000 -a $available_size -le 1048576 ]; #不要用&&
		then 
			colour black_yellow
			available_size_human=$(free -h | awk  ' NR==2 {print ($7)}')
			echo  "预防！支持应用程序的内存还剩可用'$available_size_human'，建议清理，小心使用！"
			clear_memory_available
  	else
		colour black_green
		available_size_human=$(free -h | awk  ' NR==2 {print ($7)}')
  	  	echo  "良好！支持应用程序的内存还剩可用'$available_size_human'，放心使用！"
		clear_memory_available
  	fi
	#-------------------------------------
	#还有多少物理内存可用
	#-------------------------------------
	#204800=200M
	if [ $free_size -le 204800 ]; #注意判断语句空格
	then  
		colour red_yellow
		free_size_human=$(free -h | awk  ' NR==2 {print ($4)}')
		echo  "警告！内存还剩可用'$free_size_human'，内存不够，尽快释放内存！"
		clear_memory_free
	#512000=500M
  	elif [ $free_size -gt 204800 -a $free_size -le 512000 ]; #不要用&&
		then 
			colour black_yellow
			free_size_human=$(free -h | awk  ' NR==2 {print ($4)}')
			echo  "预防！内存还剩可用'$free_size_human'，建议清理，小心使用！"
			clear_memory_free
  	else
		colour black_green
		free_size_human=$(free -h | awk  ' NR==2 {print ($4)}')
  	  	echo  "良好！内存还剩可用'$free_size_human'，是否清理"
		clear_memory_free
  	fi
}

#### network function
network_monitoring()
{
#--------------------------------------------------------------------
#-gt,-lt,-eq 比较的都是数字和变量
#因此变量tmp如果是一个字符串的话就会出现integer expression expected
#--------------------------------------------------------------------
	echo 'nvidia' | sudo -S chmod 777 /etc/network/interfaces
	#sudo chmod 777 /etc/network/interfaces
	local i=0
	dhcp_str="iface eth0 inet dhcp"
	static_str="iface eth0 inet static"
	printf_add="目前为静态地址！"
	printf_dhcp="目前为动态分配地址！"
	#static_str=$(cat /etc/network/interfaces |awk '/address /{print}')
	#echo $static_str
	echo -e "\n"
	echo 'nvidia' | sudo -S sh -c "cat /etc/network/interfaces" | while read tmp
	#cat /etc/network/interfaces | while read tmp
		do
			#if [ `echo ${tmp} | awk -v tem="$dhcp_str" '{print($1 == tem)? "1":"0"}'` -eq "1" ]
			if [ "$tmp" == "$dhcp_str" ]; 
				then
					i=1
					#echo "1：$i"  #1
					if [ $i -eq 1 ]; 
						then
							#echo "2：$i"  #1
							#echo "目前为动态分配地址！"
							echo -e "\t \033[40;33m ${printf_dhcp} \033[0m"  ## 黑底黄字
							break
					fi
			#elif [ "$static_str" == "$tmp" ];
			elif [ "$tmp" == "$static_str" ];
				then					
					#echo "目前为静态地址！"
					colour black_yellow
					#echo -e "\t \033[40;33m ${printf_add} \033[0m"  ## 黑底黄字
					echo -e "\t ${printf_add}"  ## 黑底黄字
					echo -e "\t $(echo 'nvidia' | sudo -S sh -c "cat /etc/network/interfaces |awk '/address /{print}'")"
					echo -e "\t $(echo 'nvidia' | sudo -S sh -c "cat /etc/network/interfaces |awk '/netmask /{print}'")"
					echo -e "\t $(echo 'nvidia' | sudo -S sh -c "cat /etc/network/interfaces |awk '/gateway /{print}'")"
					echo -e "\t $(echo 'nvidia' | sudo -S sh -c "cat /etc/network/interfaces |awk '/dns /{print}'")"
					break
					#echo -e "\n"
			fi
			#echo $tmp
			#echo "3：$i"  #0		
		done
	#echo "4：$i"  #0
	sudo chmod 644 /etc/network/interfaces	
	#-------------------------------------------------------
	#cd /etc/network/
	#---for i in `cat /etc/network/interfaces` #以空格输出
		#---do
			#---echo $i
		#---done
	#cd ~
	#-------------------------------------------------------
}

#### passwd function
passwd_function()
{
	i=0
	err="密码错误，请重新输入！"
	colour black_white
	while(($i==0))
	do
		PWD=nvidia
		read -p "请输入密码：" PASSWD
			if [ "$PASSWD" == "$PWD" ];
				then
					i=1
			else
				colour red_yellow
				echo -e "\033[41;33m ${err} \033[0m \n"  ## 红底黄字
				#echo "密码错误，请重新输入！"
			fi
	done
}

passwd_function

#loop forever !
while :
do
    #clear the screen
	tput clear
	colour black_yellow
	#here documents starts here
	cat <<HYSD
---------------------------------------------------------------------------
 User:$USER  Host:HYSD  Date:$MYDATE  Pwd:$PWD
---------------------------------------------------------------------------
  1 : EMMC磁盘容量检测              2 : 磁盘坏道检测
  3 : 硬件内存检测                  4 : 网络检测
  H : Help screen
  Q : Exit Menu
---------------------------------------------------------------------------
HYSD
    #here document finished
    colour black_cyan
	echo -e -n "\tYour Choice [1,2,3,4,H,Q] > "
	    read CHOICE
		case $CHOICE in
					1) 	disk_size ;;
					2) 	disk_monitoring ;;
					3) 	memory_monitoring ;;
					4)	network_monitoring ;;
					H|h)
						cat <<HYSD
	技术支持：http://www.hysdqx.com/
HYSD
;;
					Q|q)	exit 0 ;;
					*)	echo -e "\t\041Unknown user response";;
		esac
	colour black_white
	echo -e -n "\tHit the any key to continue"
	get_char
done

